package cn.v2tila.rsosa.management.filter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author v2tila on 15:09 2019/4/24
 */
//@Configuration
public class WebAppConfig implements WebMvcConfigurer {
    @Autowired
    private CheckLoginInteceptor checkLoginInteceptor;
    //配置拦截的资源以及放行的资源
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(checkLoginInteceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/login","/user/login","/fragments/**","/layout")
                //放行静态资源
                .excludePathPatterns("/images/**","/css/**","/layui/**","/js/**");
    }

    //配置静态资源的位置
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {

    }

}
